home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 008a / feb93cad.zip / TITLE.LSP < prev    next >
Text File  |  1993-02-12  |  5KB  |  151 lines

  1. ;-------------------- TITLE.LSP ----------------------------
  2. ;by    : Sundar.S
  3. ;date  : 11. Feb. 1991.
  4. ;----------------------------------------------------------
  5. (defun ds (s) (* (getvar "dimscale") s))
  6. (defun err () (prompt "\nText won't fit..."))
  7.  
  8. (defun input ()
  9.     (prompt "\n\tEnter Drawing Title.... \t")
  10.     (setq fld (getstring T "\nFirst line of description: "))
  11.     (while (> (strlen fld) 58)   ; 58 is the maximum string that would
  12.            (err)                 ; fit in the given label.
  13.            (setq fld (getstring T "\nFirst line of description: "))
  14.     )
  15.     (setq sld (getstring T "\nSecond line of description: "))
  16.     (while (> (strlen sld) 58)
  17.            (err)
  18.            (setq sld (getstring T "\nSecond line of description: "))
  19.     )
  20.     (setq tld (getstring T "\nThird line of description: "))
  21.     (while (> (strlen tld) 58)
  22.            (err)
  23.            (setq tld (getstring T "\nThird line of description: "))
  24.     )
  25.     (setq cust (getstring T "\nCustomer: "))
  26.     (while (> (strlen cust) 58)
  27.            (err)
  28.            (setq cust (getstring T "\nCustomer: "))
  29.     )
  30.     (setq dr  (getstring T "\nDrawn by: "))
  31.     (setq datee (substr (rtos (getvar "cdate")) 1 8)
  32.           datee (strcat (substr datee 7) "."
  33.                         (substr datee 5 2) "."
  34.                         (substr datee 3 2)
  35.                  )
  36.     )
  37.     (setq date (getstring (strcat "\nDate <" datee ">: ")))
  38.     (while (> (strlen date) 10)
  39.            (err)
  40.            (setq date (getstring (strcat "\nDate <" datee ">: ")))
  41.     )
  42.     (if (= date "") (setq date datee))
  43.     (setq sf (getvar "dimscale"))
  44.     (if (= sf 1.0)
  45.         (setq sf "NTS")
  46.         (setq sf (strcat "1 : " (rtos (fix sf))))
  47.     )
  48.     (setq sc (getstring T (strcat "\nScale <" sf ">: ")))
  49.     (if (= sc "") (setq sc sf))
  50.     (setq dwgno (getstring "\nDrawing number: "))
  51.     (while (or (> (strlen dwgno) 13) (= (strlen dwgno) 0))
  52.            (princ "\n\t*** Drawing Number Invalid *** ")
  53.            (setq dwgno (getstring "\nDrawing number: "))
  54.     )
  55.     (initget 4)
  56.     (setq rev  (getint "\nRevision no. <0>: "))
  57.     (initget 4)
  58.     (setq shno (getint "\nSheet number <1>: "))
  59.     (initget 4)
  60.     (setq nosh (getint "\nNo. of sheets <1>: "))
  61.     (if (= rev nil)  (setq rev "0")  (setq rev  (itoa rev)))
  62.     (if (= shno nil) (setq shno "1") (setq shno (itoa shno)))
  63.     (if (= nosh nil) (setq nosh "1") (setq nosh (itoa nosh)))
  64.     (setq dwg
  65.       (getstring (strcat "\nDrawing file name <" (getvar "dwgname") ">: "))
  66.     )
  67.     (while (> (strlen dwg) 8)
  68.            (princ "\t\n *** INVALID FILE NAME ***")
  69.            (setq dwg (getstring
  70.                 (strcat "\nDrawing file name <" (getvar "dwgname") ">: ")))
  71.            )
  72.            (if (= dwg "") (setq dwg (getvar "dwgname"))
  73.     )
  74.     (setq fno (getstring "\nFloppy diskette number: "))
  75.     (while (= fno "")
  76.            (setq fno (getstring "\nFloppy diskette number: "))
  77.     )
  78.     (setq wt (getstring "\nTotal weight: "))    ; only for dbase record.
  79.  )
  80.  
  81.  (defun writing ()
  82.     (setq txt "text")
  83.     (command txt "m" (list (ds 774) (ds 46)) (ds 2.5) "0" fld
  84.      ;'(774 46) is the middle point of the given label.
  85.              txt "m" (list (ds 774) (ds 40)) (ds 2.5) "0" sld
  86.              txt "m" (list (ds 774) (ds 33)) (ds 2.5) "0" tld
  87.              txt "m" (list (ds 774) (ds 27)) (ds 2.5) "0"
  88.              (strcat "CUSTOMER: " (strcase cust))
  89.              txt (list (ds 694) (ds 44.5) ) (ds 2) "0" dr
  90.              txt (list (ds 699) (ds 37)) (ds 2) "0" date
  91.              txt (list (ds 699) (ds 29.5)) (ds 2) "0" sc
  92.              txt "m" (list (ds 813) (ds 11)) (ds 2.5) "0" rev
  93.              txt (list (ds 829) (ds 14.5)) (ds 2.5) "0" shno
  94.              txt (list (ds 829) (ds 7.5)) (ds 2.5) "0" nosh
  95.              txt (list (ds 689) (ds 51)) (ds 2.5) "90"
  96.              (strcase (strcat fno "/" dwg))
  97.     )
  98.     (setq p (list (ds 717) (ds 11)) n 1)
  99.     (if (/= dwgno nil)
  100.         (progn
  101.             (repeat (strlen dwgno)
  102.                     (command txt "m" p (ds 3) "0" (substr dwgno n 1))
  103.                     (setq n (1+  n))
  104.                     (setq p (polar p 0 (ds 7.08)))
  105.            ; 7.08 is the distance between two digits in the drawing number.
  106.              )
  107.          )
  108.     )
  109.     (prin1)
  110. )
  111.  
  112. (defun struc (count str / tt dd )
  113.     (setq tt "")
  114.     (if (> count (strlen str))
  115.         (progn
  116.             (setq tt
  117.                 (repeat (- count (strlen str))
  118.                         (setq tt (strcat tt (chr 32)))
  119.                 )
  120.             )
  121.             (setq dd (strcase (strcat str tt)))
  122.         )
  123.         (setq dd (strcase (substr str 1 count)))
  124.     )
  125.     (setq txt (strcat txt dd))
  126. )
  127.  
  128. (defun dbplus ()
  129.     (setq txt "")
  130.     (setq file (open "title.prn" "a"))
  131.     (struc 60 fld) (struc 60 sld) (struc 60 tld) (struc 60 cust) (struc 15 dr)
  132.     (struc 10 date) (struc 11 sc) (struc 16 dwgno) (struc 2 rev)
  133.     (struc 2 shno) (struc 2 nosh) (struc 8 dwg) (struc 5 fno) (struc 8 wt)
  134.     (princ txt file)
  135.     (princ "\n" file)
  136.     (close file)
  137. )
  138.  
  139. (defun c:title ()
  140.    (setvar "cmdecho" 0)
  141.    (setvar "blipmode" 0)
  142.    (setvar "highlight" 0)
  143.    (command "undo" "g")
  144.    (input)
  145.    (writing)
  146.    (dbplus)
  147.    (command "undo" "e")
  148.    (prin1)
  149. )
  150. 
  151.